#include "netconfig.h"

static netconfig_app_t *local_app;

extern lv_indev_t *my_indev;
extern app_t curr_page;
extern list_app_t list_app;

static const char *TAG = "netconfig";

static void event_handler(lv_event_t *e)
{
    lv_event_code_t code = lv_event_get_code(e);

    if (code == LV_EVENT_CLICKED)
    {
        LV_LOG_USER("Clicked");
    }
}

void create_netconfig_app(netconfig_app_t *app)
{
    local_app = app;
    curr_page = NETCONFIG_APP;

    lv_obj_t *scr = lv_obj_create(NULL);

    lv_obj_t *line1 = lv_obj_create(scr);
    lv_obj_set_layout(line1, LV_LAYOUT_FLEX);
    lv_obj_set_flex_flow(line1, LV_FLEX_FLOW_COLUMN);

    lv_obj_t *label;

    lv_obj_t *btn = lv_btn_create(line1);
    lv_obj_add_event_cb(btn, event_handler, LV_EVENT_ALL, NULL);

    label = lv_label_create(btn);
    lv_label_set_text(label, "Button");
    lv_obj_center(label);

    btn = lv_btn_create(line1);
    lv_obj_add_event_cb(btn, event_handler, LV_EVENT_ALL, NULL);

    label = lv_label_create(btn);
    lv_label_set_text(label, "Button2");
    lv_obj_center(label);

    lv_obj_del(lv_scr_act());
    lv_scr_load(scr);
}

void remove_netconfig_app()
{
}